﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:myBoard.App.Components.MagnetsStore" x:Name="userControl" x:Class="myBoard.App.Components.MagnetsStore.MagnetReview" mc:Ignorable="d">
	<UserControl.Resources>
		<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
		<SolidColorBrush x:Key="ListBorder" Color="#828790"/>
		<Style x:Key="MagnetScreenshotsStyle" TargetType="{x:Type ListBox}">
			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBox}">
						<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
							<ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
								<ItemsPresenter MaxWidth="870" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
							</ScrollViewer>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
							</Trigger>
							<Trigger Property="IsGrouping" Value="true">
								<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<DataTemplate x:Key="MagnetScreenshotsDataTemplate">
			<Grid>
				<Image Width="200" Height="200" Source="{Binding Mode=Default}"/>
			</Grid>
		</DataTemplate>
		<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
			<WrapPanel IsItemsHost="True"/>
		</ItemsPanelTemplate>
		<DataTemplate x:Key="MagnetCommentDataTemplate">
			<Grid Width="860" Height="Auto">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="100"/>
					<ColumnDefinition Width="760"/>
				</Grid.ColumnDefinitions>
				<Border Margin="0,0,0,-0.001" Grid.ColumnSpan="2" d:LayoutOverrides="Width" Background="{x:Null}">
					<Border Background="{x:Null}" BorderBrush="#FFC9C9C9" BorderThickness="1" Margin="10">
						<StackPanel Margin="10" Orientation="Vertical">
							<StackPanel Orientation="Horizontal">
								<Grid Width="70" Height="55" HorizontalAlignment="Left">
									<Border BorderThickness="2" CornerRadius="10" Width="50" Height="50" HorizontalAlignment="Center" VerticalAlignment="Top" BorderBrush="#FFE4E4E4">
										<Image x:Name="_avatar" Source="{Binding Author.AvatarUrl, Mode=Default}">
											<Image.Clip>
												<RectangleGeometry x:Name="boltClipRect" Rect="0,0,76,76" RadiusX="9" RadiusY="9"/>
											</Image.Clip>
										</Image>
									</Border>
									<Path Stretch="Fill" Stroke="#00000000" Width="41" Height="40" Data="M0.5,10.5 C0.5,4.9771525 4.9771525,0.5 10.5,0.5 L69.5,0.5 C75.022847,0.5 46.278051,10.843348 27.196453,25.803521 6.8205525,41.778441 0.5,72.352005 0.5,69.5 z" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="11,1,0,0">
										<Path.Fill>
											<LinearGradientBrush EndPoint="0.851,0.854" StartPoint="-0.024,-0.028">
												<GradientStop Color="White" Offset="0"/>
												<GradientStop Offset="0.56"/>
											</LinearGradientBrush>
										</Path.Fill>
									</Path>
								</Grid>
								<StackPanel Margin="0" Width="760" d:LayoutOverrides="HorizontalMargin">
									<StackPanel Orientation="Vertical">
										<TextBlock Margin="0" Foreground="#FFFCB420" Text="{Binding Author.Nickname, Mode=Default}" TextWrapping="Wrap" FontFamily="Candara" FontSize="18.667"/>
										<TextBlock Margin="0,0,-0.001,0" Foreground="#FF616161" Text="{Binding SubmissionDate, Mode=Default}" TextWrapping="Wrap" FontSize="10.667"/>
									</StackPanel>
								</StackPanel>
							</StackPanel>
							<StackPanel Margin="10,10,0,0" Orientation="Horizontal">
								<TextBlock Text="{Binding Title, Mode=Default}" TextWrapping="Wrap" Foreground="#FF616161" FontFamily="Candara" FontSize="13.333" Margin="0,0,10,0" VerticalAlignment="Top" Width="Auto"/>
								<local:Ratings Height="Auto" MaxRating="5" HorizontalAlignment="Stretch" Rating="{Binding Rating, Mode=Default}" Margin="0" VerticalAlignment="Center"/>
							</StackPanel>
							<TextBlock TextWrapping="Wrap" Foreground="#FF616161" Margin="10" VerticalAlignment="Top" Width="Auto" FontSize="10.667" Text="{Binding Description, Mode=Default}"/>
						</StackPanel>
					</Border>
				</Border>
			</Grid>
		</DataTemplate>
		<Style x:Key="alternatingWithTriggers" TargetType="{x:Type ListBoxItem}">
      <Setter Property="Background" Value="#00FFFFFF"/>
      <Setter Property="Template" Value="{DynamicResource ListBoxItemControlTemplate1}"/>
      <Style.Triggers>
        <Trigger Property="ItemsControl.AlternationIndex" Value="1">
          <Setter Property="Background" Value="#11000000"/>
        </Trigger>
      </Style.Triggers>
    </Style>
		<Style x:Key="MagnetCommentsListboxStyle" TargetType="{x:Type ItemsControl}">
			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ItemsControl}">
						<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
							<ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
								<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
							</ScrollViewer>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<ControlTemplate x:Key="ListBoxItemControlTemplate1" TargetType="{x:Type ListBoxItem}">
			<Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
				<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
			</Border>
			<ControlTemplate.Triggers>
				<Trigger Property="IsEnabled" Value="False">
					<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
	</UserControl.Resources>
	<Grid d:LayoutOverrides="Width, Height">
		<Grid.Background>
			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
				<GradientStop Color="#FFF8F8F8" Offset="1"/>
				<GradientStop Color="#FFF8F8F8"/>
			</LinearGradientBrush>
		</Grid.Background>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>			
		</Grid.RowDefinitions>
		<StackPanel Margin="0">
			<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
				<Button x:Name="_returnToMagnetBt" Margin="0" Content="&lt;&lt; Back" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{DynamicResource StoreButtonStyle1}" Foreground="White" Height="25" Cursor="Hand" Width="90"/>
				<Button x:Name="_submitCommentBt" Margin="10,0,0,0" Content="Submit a review" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{DynamicResource StoreButtonStyle1}" Foreground="White" Height="25" Cursor="Hand" Width="120" DataContext="{Binding ForMagnet, ElementName=userControl, Mode=Default}" Visibility="{Binding CanSubmitReview, Converter={StaticResource BooleanToVisibilityConverter}, Mode=Default}"/>
			</StackPanel>
			<local:SubmitCommentControl x:Name="_submitCommentControl" Margin="0,0,10,0" Visibility="Collapsed"/>
		</StackPanel>
		<ItemsControl Margin="0,10,0,0" ItemsSource="{Binding Mode=Default}" ItemTemplate="{DynamicResource MagnetCommentDataTemplate}" AlternationCount="2" BorderBrush="{x:Null}" Grid.Row="1" Height="500" Style="{DynamicResource MagnetCommentsListboxStyle}" Background="{x:Null}"/>
	</Grid>
</UserControl>
